package main

import "fmt"

func main(){
	//map定义
	m := map[int]string{1:"mike",2:"mary"}

	//遍历map
	for k,v := range m{
		fmt.Printf("%d=%s;\n", k, v)
	}

	//判断key是否存在
	if value,ok := m[1];ok==true{
		fmt.Printf("m[1]=%v\n",value)
	}

	//删除map的key
	delete(m,1)
	for k,v := range m{
		fmt.Printf("%d=%s;\n", k, v)
	}
}
